/* 最小割应用
    边割集的定义与最小割中的割边的集合不同。
    在本题中，一个边割集是指：将这些边删去之后，s与t不再连通

    check边:对于权值 we−λ≤0的边肯定是选上更优，故先把这部分边选上，
    而对于其他边则在满足要求的情况下越小越好，即最后只剩下边权非负的边，等价于求解最小割，因为把最小割S连向T的边都删除后s和t一定不连通，且涉及的非负边权和最小
*/

#define DEBUG
#pragma GCC optimize("O1,O2,O3,Ofast")
#pragma GCC optimize("no-stack-protector,unroll-loops,fast-math,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,ssse3")

#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

const int N = 110, M = 810;//, INF = 0x3f3f3f3f;
const double eps = 1e-8, INF = 1e8;
int n, m, S, T;
int e[M], h[N], w[M], ne[M], idx; //w[]边的权值
double f[M]; //f[]边的流量
int q[N], cur[N], d[N];


void AddEdge(int a, int b, int c)
{
    e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx++;
    //e[idx] = a, c[idx] = 0, ne[idx] = h[b], h[b] = idx++;
}

bool bfs()
{
    int hh = 0, tt = -1;
    memset(d, -1, sizeof d);
    q[++tt] = S, cur[S] = h[S], d[S] = 0;
    while(hh <= tt)
    {
        int u = q[hh++];
        for(int i = h[u]; ~i; i = ne[i])
        {
            int v = e[i];
            if(d[v] == -1 && f[i] > eps)
            {
                d[v] = d[u] + 1;
                cur[v] = h[v];
                if(v == T) return true;
                q[++tt] = v;
            }
        }
    }
    return false;
}

double find(int u, double limit)
{
    if(u == T) return limit;
    double flow = 0;
    for(int i = cur[u]; ~i && limit > flow; cur[u] = i, i = ne[i])
    {
        int v = e[i];
        if(d[v] == d[u] + 1 && f[i])
        {
            double t = find(v, min(f[i], limit - flow));
            if(!t) d[v] = -1;
            f[i] -= t, f[i^1] += t, flow += t;
        }
    }
    return flow;
}

bool Dinic(double mid)
{
    double res = 0, flow = 0; //非正边权值和
    for(int i = 0; i < idx; i += 2) //枚举正向边
        if(w[i] <= mid) //新图中的非正边
        {
            res += w[i] - mid;
            f[i] = f[i^1] = 0; //两条边已选，删掉这两条边->容量设为0
        }
        else f[i] = f[i^1] = w[i] - mid; //否则减去mid，变为新图中的边
    //printf("mid:%.2lf res:%.2lf\n", mid, res);
    while(bfs())
        while((flow = find(S, INF)) > eps) res += flow;
    return res <= eps; ///边割集的权值和 = 非正边的权值和 + 正边的权值和（最小割）
}

signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
    #else
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    memset(h, -1, sizeof h);
    cin >> n >> m >> S >> T;

    for(int i=1; i<=m; i++)
    {
        int a, b, c; cin >> a >> b >> c;
        AddEdge(a, b, c); AddEdge(b, a, c); 
    }

    double l = 1, r = 1e7;
    while(fabs(r-l) > eps) //二分答案
    {
        double mid = (l + r) / 2;
        if(Dinic(mid)) r = mid;
        else l = mid;
    }
    printf("%.2lf\n", l);
    return 0;
}
